package org.apache.ibatis.common.reflection;

import org.apache.ibatis.common.io.Resources;

/**
 * @Name Jdk
 * @Description: JDK 包工具类
 * 描述信息：因为不同的 JDK 提供的包有所不同，该类主要用来判断当前 JDK 版本是否存在指定的包。
 * @Version v1.0.0
 * @Author: lichao
 * @Date: 2024-04-28 17:45:41
 **/
public class Jdk {

    private Jdk() {
    }

    public static final boolean parameterExists;

    static {
        boolean available = false;
        try {
            Resources.classForName("java.lang.reflect.Parameter");
            available = true;
        } catch (ClassNotFoundException e) {
        }
        parameterExists = available;
    }

    public static final boolean dateAndTimeApiExists;

    static {
        boolean available = false;
        try {
            Resources.classForName("java.time.Clock");
            available = true;
        } catch (ClassNotFoundException e) {
        }
        dateAndTimeApiExists = available;
    }

    public static final boolean optionalExists;

    static {
        boolean available = false;
        try {
            Resources.classForName("java.util.Optional");
            available = true;
        } catch (ClassNotFoundException e) {
        }
        optionalExists = available;
    }

}

